package com.apes.framework.plugin.esb.processor.idempotent;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.ApesBean;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.jpa.tuple.date.DateTime;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * 功能：防重表
 *
 * @author xul
 * @create 2019-11-21 15:00
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = AntiHeavy.CONST_TABLE_NAME)
public class AntiHeavy implements ApesBean {
    public static final String CONST_TABLE_NAME = "ir_anti_heavy";

    @Id
    @Column(name = "id", nullable = false, length = 128)
    private String id;

    @JSONField(serialize = false)
    @DateTime
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "last_updated_stamp")
    @Comment("时间戳")
    private Date lastUpdatedStamp;
}
